How do I know for sure when Layout is running this code?
if (!null current Trigger)
{} // Running as trigger
elseif(null obj)
{ // Not Attr-DXL nor Layout, must be On-Demand
if (null current Object)
{} // Not reasonable
else print "On-Demand: " identifier(current Object) "\n"
}
elseif(!null attrDXLName)
obj.attrDXLName = "Attr-DXL: " identifier(obj) "" // Attr-DXL
else
display("Layout: " identifier(obj) "") // What else? Must be a Layout
llandale - Wed Jun 08 14:00:06 EDT 2011 |
Re: Is Layout Hi Louie, when scrolling, DOORS will evaluate the layout DXL a couple of times, the first one being to evaluate the height of the column, by preprocessing the output. I saw an addition at a layout column once, that checked a special function or flag to determine if the layout is running in this mode:
if (getCalculatingLayoutHeight_()) {
return
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Is Layout Mathias Mamsch - Fri Jun 10 06:41:57 EDT 2011 Hi Louie, when scrolling, DOORS will evaluate the layout DXL a couple of times, the first one being to evaluate the height of the column, by preprocessing the output. I saw an addition at a layout column once, that checked a special function or flag to determine if the layout is running in this mode:
if (getCalculatingLayoutHeight_()) {
return
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I would rather try the documented getCanvas perm: it should be null outside a layout DXL call. If I recall properly, a layout DXL was run several times for each refreshed cell, until DOORS knows the appropriate height for the whole line, then everything was re-computed again. This caused very poor performances as soon as more than three DXL columns were displayed. The problem was fixed around Doors 7 I think. Anyway a simple script proves that getCalculatingLayoutHeight_ is true one out of three execution of the layout DXL, so it is not reliable to distinguish DXL Attributes from Layout DXL. Kind Regards, - Éric |
Re: Is Layout ePiallat - Fri Jun 10 09:58:22 EDT 2011
Well that worked, getCanvas() consistently predicted a Layout.
if (getCanvas())
{ // Running as layout, do layout stuff
DBE dbeCan = getCanvas()
...
}
// Context return parameters for fContext_GetDxlContext()
const int c_Context_Trigger = 0,
c_Context_OnDemand = 1,
c_Context_Layout = 2,
c_Context_AttrDXL = 3,
c_Context_LouieMadeMistake = 4
//*************************************************
int fContext_GetDxlContext()
{ // Get the Context of the currently executing DXL, either
// = c_Context_Trigger when running as some Trigger
// = c_Context_OnDemand when running as some On-Demand script (e.g. menu or DXL window)
// = c_Context_Layout when running as a Layout column
// = c_Context_AttrDXL when running as Attr DXL
// = c_Context_LouieMadeMistake otherwise
// Developer's notes: variable 'obj' is pre-defined and is set to non-null for Layout and AttrDXL.
// Variable attrDXLName gets set for AttrDXL, but for unclear reason's of display
// will sometimes take a real value in a layout in a view with other AttrDXL,
// so checking that is unreliable.
// Function DBE getCanvas() only returns a Canvas DBE while inside a layout,
// so that function is used (credit Eric Piallat here:
// https://www.ibm.com/developerworks/forums/thread.jspa?threadID=373445&tstart=0)
if (!null current Trigger) return(c_Context_Trigger)
elseif(null obj) return(c_Context_OnDemand)
elseif(!null (DBE getCanvas())) return(c_Context_Layout)
elseif(!null attrDXLName) return(c_Context_AttrDXL)
else
{ // print ">>fContext_GetDxlContext, Unknown context for this DXL\n"
return(c_Context_LouieMadeMistake)
}
} // end fContext_GetDxlContext()
//*************************************************
bool fContext_IsTrigger()
{ // Is the current DXL context a Trigger?
return(fContext_GetDxlContext() == c_Context_Trigger)
} // end fContext_IsTrigger()
//*************************************************
bool fContext_IsOnDemand()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_OnDemand)
} // end fContext_IsOnDemand()
//*************************************************
bool fContext_IsLayout()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_Layout)
} // end fContext_IsLayout()
//*************************************************
bool fContext_IsAttrDXL()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_AttrDXL)
} // end fContext_IsAttrDXL()
if (fContext_IsTrigger())
{} // Running as trigger
elseif(fContext_IsOnDemand())
{ // Not Attr-DXL nor Layout, must be On-Demand
if (null current Object)
{} // Not reasonable
else print "On-Demand: " identifier(current Object) "\n"
}
elseif(fContext_IsLayout())
display("Layout: " identifier(obj) "") // Layout
elseif(fContext_IsAttrDXL())
obj.attrDXLName = "Attr-DXL: " identifier(obj) "" // Attr-DXL
else{}
|
Re: Is Layout llandale - Fri Jun 10 15:28:24 EDT 2011
Well that worked, getCanvas() consistently predicted a Layout.
if (getCanvas())
{ // Running as layout, do layout stuff
DBE dbeCan = getCanvas()
...
}
// Context return parameters for fContext_GetDxlContext()
const int c_Context_Trigger = 0,
c_Context_OnDemand = 1,
c_Context_Layout = 2,
c_Context_AttrDXL = 3,
c_Context_LouieMadeMistake = 4
//*************************************************
int fContext_GetDxlContext()
{ // Get the Context of the currently executing DXL, either
// = c_Context_Trigger when running as some Trigger
// = c_Context_OnDemand when running as some On-Demand script (e.g. menu or DXL window)
// = c_Context_Layout when running as a Layout column
// = c_Context_AttrDXL when running as Attr DXL
// = c_Context_LouieMadeMistake otherwise
// Developer's notes: variable 'obj' is pre-defined and is set to non-null for Layout and AttrDXL.
// Variable attrDXLName gets set for AttrDXL, but for unclear reason's of display
// will sometimes take a real value in a layout in a view with other AttrDXL,
// so checking that is unreliable.
// Function DBE getCanvas() only returns a Canvas DBE while inside a layout,
// so that function is used (credit Eric Piallat here:
// https://www.ibm.com/developerworks/forums/thread.jspa?threadID=373445&tstart=0)
if (!null current Trigger) return(c_Context_Trigger)
elseif(null obj) return(c_Context_OnDemand)
elseif(!null (DBE getCanvas())) return(c_Context_Layout)
elseif(!null attrDXLName) return(c_Context_AttrDXL)
else
{ // print ">>fContext_GetDxlContext, Unknown context for this DXL\n"
return(c_Context_LouieMadeMistake)
}
} // end fContext_GetDxlContext()
//*************************************************
bool fContext_IsTrigger()
{ // Is the current DXL context a Trigger?
return(fContext_GetDxlContext() == c_Context_Trigger)
} // end fContext_IsTrigger()
//*************************************************
bool fContext_IsOnDemand()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_OnDemand)
} // end fContext_IsOnDemand()
//*************************************************
bool fContext_IsLayout()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_Layout)
} // end fContext_IsLayout()
//*************************************************
bool fContext_IsAttrDXL()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_AttrDXL)
} // end fContext_IsAttrDXL()
if (fContext_IsTrigger())
{} // Running as trigger
elseif(fContext_IsOnDemand())
{ // Not Attr-DXL nor Layout, must be On-Demand
if (null current Object)
{} // Not reasonable
else print "On-Demand: " identifier(current Object) "\n"
}
elseif(fContext_IsLayout())
display("Layout: " identifier(obj) "") // Layout
elseif(fContext_IsAttrDXL())
obj.attrDXLName = "Attr-DXL: " identifier(obj) "" // Attr-DXL
else{}
By the way, why would you want to distinguish between a layout, attribute DXL or trigger DXL? Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Is Layout ePiallat - Fri Jun 10 09:58:22 EDT 2011 By the way, when trying this code on my module with 3 visible objects i got: bool b = getCalculatingLayoutHeight_() bool c = null getCanvas() print (identifier obj) "/ AttrName=" attrDXLName "/ LayoutHeight= " b "/Null Canvas=" c "\n"
TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-20/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-62/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false TC_CUTE-20/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false TC_CUTE-62/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Is Layout Mathias Mamsch - Fri Jun 10 15:54:36 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Is Layout Mathias Mamsch - Fri Jun 10 16:13:20 EDT 2011 By the way, when trying this code on my module with 3 visible objects i got: bool b = getCalculatingLayoutHeight_() bool c = null getCanvas() print (identifier obj) "/ AttrName=" attrDXLName "/ LayoutHeight= " b "/Null Canvas=" c "\n"
TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-20/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-62/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false TC_CUTE-20/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false TC_CUTE-62/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Didn't keep the code from a couple days ago, but I had a layout printing attrDXLName() and while it usually was correctly null, I noticed that when you scrolled the module it would run the Layout with the name of some attrDXL actually displayed; but when you subsequently moved a window over the module, the layout DXL would fire repeatedly of course but attrDXLName would be back to null. Not sure what to think about that.
// Context return parameters for fContext_GetDxlContext()
const int c_Context_Trigger = 0,
c_Context_OnDemand = 1,
c_Context_Layout = 2,
c_Context_AttrDXL = 3,
c_Context_LouieMadeMistake = 4
bool g_Context_ErrorPrinted = false // Print bad context once per DXL
//*************************************************
int fContext_GetDxlContext()
{ // Get the Context of the currently executing DXL, either
// = c_Context_Trigger when running as some Trigger
// = c_Context_OnDemand when running as some On-Demand script (e.g. menu or DXL window)
// = c_Context_Layout when running as a Layout column
// = c_Context_AttrDXL when running as Attr DXL
// = c_Context_LouieMadeMistake otherwise
// Developer's notes: variable 'obj' is pre-defined and is set to non-null for Layout and AttrDXL.
// Variable attrDXLName gets set for AttrDXL, but for unclear reason's of display
// will sometimes take a real value in a layout in a view with other AttrDXL,
// so checking that is unreliable.
// Function currentColumn() appears to ONLY return a 'Column' handle when
// the DXL is indeed running in a layout.
if (!null current Trigger) return(c_Context_Trigger)
elseif(null obj) return(c_Context_OnDemand)
elseif(!null currentColumn()) return(c_Context_Layout)
elseif(!null attrDXLName) return(c_Context_AttrDXL)
else
{ if (! g_Context_ErrorPrinted)
{ g_Context_ErrorPrinted = true
print ">>fContext_GetDxlContext, Unknown context for this DXL\n"
}
return(c_Context_LouieMadeMistake)
}
} // end fContext_GetDxlContext()
//*************************************************
bool fContext_IsTrigger()
{ // Is the current DXL context a Trigger?
return(fContext_GetDxlContext() == c_Context_Trigger)
} // end fContext_IsTrigger()
//*************************************************
bool fContext_IsOnDemand()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_OnDemand)
} // end fContext_IsOnDemand()
//*************************************************
bool fContext_IsLayout()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_Layout)
} // end fContext_IsLayout()
//*************************************************
bool fContext_IsAttrDXL()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_AttrDXL)
} // end fContext_IsAttrDXL()
if (fContext_IsTrigger())
{} // Running as trigger
elseif(fContext_IsOnDemand())
{ // Not Attr-DXL nor Layout, must be On-Demand
if (null current Object)
{} // Not reasonable
else print "On-Demand: " identifier(current Object) "\n"
}
elseif(fContext_IsLayout())
display("Layout: " identifier(obj) "") // What else? Must be a Layout
elseif(fContext_IsAttrDXL())
obj.attrDXLName = "Attr-DXL: " identifier(obj) "" // Attr-DXL
else{}
print "Curr Col = " (null currentColumn()) "\n" Module g_mCurr = current int iCol = getSelectedCol(g_mCurr) Column col = column(g_mCurr, iCol) string Text = text(col, (current Object)) print "from column " iCol " [" Text "]\n"
|
Re: Is Layout Mathias Mamsch - Fri Jun 10 16:13:20 EDT 2011 By the way, when trying this code on my module with 3 visible objects i got: bool b = getCalculatingLayoutHeight_() bool c = null getCanvas() print (identifier obj) "/ AttrName=" attrDXLName "/ LayoutHeight= " b "/Null Canvas=" c "\n"
TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-20/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-62/ AttrName=DXL Testcase ID/ LayoutHeight= true/Null Canvas=false TC_CUTE-2/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false TC_CUTE-20/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false TC_CUTE-62/ AttrName=DXL Testcase ID/ LayoutHeight= false/Null Canvas=false
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Nice job Louis! print "\tA" (identifier obj) "" if (getCalculatingLayoutHeight_) print "B" (identifier obj) "" if (!null getCanvas()) print "C" (identifier obj) ""
A11C11 A5C5 A6C6 A7C7 A8C8 A9C9 A10C10 A11C11 A5C5 A6C6 A7C7
A8C8 A9C9 A10C10 A11C11 A5C5 A6C6 A7C7 A8C8 A9C9 A10C10 A11C11
A5C5 A6C6 A7C7 A8C8 A9C9 A10C10 A11C11 A5C5 A6C6 A7C7 A8C8
A9C9 A10C10 A11C11 A5C5 A6C6 A7C7 A8C8 A9C9 A10C10 A11C11 A5C5
A6C6 A7C7 A8C8 A9C9 A10C10 A11C11
A20B20C20 A21B21C21 A22B22C22 A22B22C22 A20B20C20 A21B21C21
A22B22C22 A23B23C23 A24B24C24 A25B25C25 A26B26C26 A20C20
A21C21 A22C22 A23C23 A24C24 A25C25 A26C26
|
Re: Is Layout llandale - Fri Jun 10 17:16:07 EDT 2011
Didn't keep the code from a couple days ago, but I had a layout printing attrDXLName() and while it usually was correctly null, I noticed that when you scrolled the module it would run the Layout with the name of some attrDXL actually displayed; but when you subsequently moved a window over the module, the layout DXL would fire repeatedly of course but attrDXLName would be back to null. Not sure what to think about that.
// Context return parameters for fContext_GetDxlContext()
const int c_Context_Trigger = 0,
c_Context_OnDemand = 1,
c_Context_Layout = 2,
c_Context_AttrDXL = 3,
c_Context_LouieMadeMistake = 4
bool g_Context_ErrorPrinted = false // Print bad context once per DXL
//*************************************************
int fContext_GetDxlContext()
{ // Get the Context of the currently executing DXL, either
// = c_Context_Trigger when running as some Trigger
// = c_Context_OnDemand when running as some On-Demand script (e.g. menu or DXL window)
// = c_Context_Layout when running as a Layout column
// = c_Context_AttrDXL when running as Attr DXL
// = c_Context_LouieMadeMistake otherwise
// Developer's notes: variable 'obj' is pre-defined and is set to non-null for Layout and AttrDXL.
// Variable attrDXLName gets set for AttrDXL, but for unclear reason's of display
// will sometimes take a real value in a layout in a view with other AttrDXL,
// so checking that is unreliable.
// Function currentColumn() appears to ONLY return a 'Column' handle when
// the DXL is indeed running in a layout.
if (!null current Trigger) return(c_Context_Trigger)
elseif(null obj) return(c_Context_OnDemand)
elseif(!null currentColumn()) return(c_Context_Layout)
elseif(!null attrDXLName) return(c_Context_AttrDXL)
else
{ if (! g_Context_ErrorPrinted)
{ g_Context_ErrorPrinted = true
print ">>fContext_GetDxlContext, Unknown context for this DXL\n"
}
return(c_Context_LouieMadeMistake)
}
} // end fContext_GetDxlContext()
//*************************************************
bool fContext_IsTrigger()
{ // Is the current DXL context a Trigger?
return(fContext_GetDxlContext() == c_Context_Trigger)
} // end fContext_IsTrigger()
//*************************************************
bool fContext_IsOnDemand()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_OnDemand)
} // end fContext_IsOnDemand()
//*************************************************
bool fContext_IsLayout()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_Layout)
} // end fContext_IsLayout()
//*************************************************
bool fContext_IsAttrDXL()
{ // Is the current DXL context On-Demand?
return(fContext_GetDxlContext() == c_Context_AttrDXL)
} // end fContext_IsAttrDXL()
if (fContext_IsTrigger())
{} // Running as trigger
elseif(fContext_IsOnDemand())
{ // Not Attr-DXL nor Layout, must be On-Demand
if (null current Object)
{} // Not reasonable
else print "On-Demand: " identifier(current Object) "\n"
}
elseif(fContext_IsLayout())
display("Layout: " identifier(obj) "") // What else? Must be a Layout
elseif(fContext_IsAttrDXL())
obj.attrDXLName = "Attr-DXL: " identifier(obj) "" // Attr-DXL
else{}
print "Curr Col = " (null currentColumn()) "\n" Module g_mCurr = current int iCol = getSelectedCol(g_mCurr) Column col = column(g_mCurr, iCol) string Text = text(col, (current Object)) print "from column " iCol " [" Text "]\n"
Aaaaarrrrrrgh.
if (!null current Trigger) return(c_Context_Trigger)
elseif(null obj and !null attrDXLName) return(c_Context_AttrDXL)
elseif(null obj) return(c_Context_OnDemand)
elseif(!null currentColumn()) return(c_Context_Layout)
elseif(!null attrDXLName) return(c_Context_AttrDXL)
else
|